package com.abc;


import java.util.*;
public class Words1 {

public static void main(String[] args){

char words;

String str;

Scanner sc =new Scanner(System.in);

System.out.println("请输⼊字符串：");

str = sc.nextLine();


System.out.println("请输入开头的字母：");

words = sc.next().charAt(0);
int count =0;

String[] strArray = str.split(" ");//把字符串通过" "(空格)拆分为字符串数组

for(int i =0; i < strArray.length; i++){

if(strArray[i].charAt(0)== words)

{

count++;

}

}

System.out.println(count);

}

}
